<template>
	<view>
		<u-card border-radius='0' :show-head="false" :show-foot="false" padding="0" margin="20rpx" :border="false">
			<view slot="body">
				<view style="font-size: 36rpx; margin-top: 20rpx; margin-bottom: 20rpx;" :style="{display: guessLikeData.isShowPlateName ? 'block' : 'none'}">
					<view>{{guessLikeData.plateName}}</view>
				</view>
				<view class="hours-lists" v-for="(item,index) in guessLikeData.list" :key="index" @click="gotoDetail(item.houseId,item.type)"
				 style="">
					<u-row>
						<u-col :span="4" @click="gotoDetail(item.houseId,item.type)">
							<view style="width: 100%">
								<image class="img-list" :src="item.picPath" alt="" ></image>
							</view>
						</u-col>
						<u-col :span="7.5" :offset="0.5" @click="gotoDetail(item.houseId,item.type)">
							<view>
								<span style="font-size: 32rpx;">{{item.title}}</span>
							</view>
							<view style="margin-top: 15rpx;">
								<u-tag size="mini" type="info" mode="plain" :text="item.doorModel"></u-tag>
								<u-tag style="margin-left: 15rpx;" size="mini" type="info" mode="plain" :text="item.area"></u-tag>
								<u-tag style="margin-left: 15rpx;" size="mini" type="info" mode="plain" :text="item.toward"></u-tag>
							</view>
							<view style="margin-top: 15rpx;">
								<span style="margin-top: 10rpx; font-size: 35rpx; color: #FF0000;">{{item.price}}</span>
							</view>
						</u-col>
					</u-row>
				</view>
			</view>
			<u-divider>没有更多了</u-divider>
		</u-card>
	</view>
</template>

<script>
	import config from '../../../utils/config.js'
	export default {
		data() {
			return {

			}
		},
		methods: {
			gotoDetail(houseId, type) {
				// console.log("点到了")
				//跳转到租房或者卖房详情页
				if (type === 0) {
					wx.navigateTo({
						// url: 'test?id=1&name=uapp'  c传递参数
						url: '/pages/components/rentDetail?houseId=' + houseId + '&recommandId=' + this.dataList.recommandId
					})
				} else {
					wx.navigateTo({
						// url: 'test?id=1&name=uapp'  c传递参数
						url: '/pages/components/buyDetail?houseId=' + houseId + '&recommandId=' + this.dataList.recommandId
					})
				}
			}
		},
		computed: {
			guessLikeData() {
				// console.log(this.dataList)
				var list = []
				var houseInfo = this.dataList.houseInfo
				//获取图片的路径
				for (let i = 0; i < houseInfo.list.length; i++) {
					let picPath = ''
					// let imageAddressList = houseInfo.list[i].imageAddressList
					// picPath = config.host + imageAddressList[0].address
					let house = []
					house = houseInfo.list[i].house
					if(house.indexImage !== '' && house.indexImage !== null){
						picPath = config.host + house.indexImage
					}
					let title = house.title
					let data = {
						"houseId": house.id,
						"picPath": picPath,
						"title": title,
						"type": house.type,
						"price": house.price,
						"doorModel": house.doorModel,
						"area": house.area,
						"toward": house.toward

					}
					list.push(data)
				}
				var show = {
					"plateName": this.dataList.plateName,
					"isShowPlateName": this.dataList.isShowPlateName,
					"list": list,
				}
				return show
			}
		},
		props: {
			dataList: {}
		}
	}
</script>

<style>
	.hours-lists {
		margin-top: 20rpx;
		width: 100%;
		height: fit-content;
	}

	.img-list-box {
		height: 160rpx;
	}

	.img-list {
		height: 160rpx;
		position: relative;
		width: 100%;
	}
</style>
